package com.example.administrator.uis.view.paint

import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
import com.example.administrator.uis.R

/**
 * Created by zhiweijin on 17-11-13.
 */
class PracticeBitmapShaderView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {

    var paint = Paint(Paint.ANTI_ALIAS_FLAG)
    var bitmap=BitmapFactory.decodeResource(resources, R.drawable.timg)
   var shade=BitmapShader(bitmap,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP)
    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        paint.shader = shade
        canvas?.drawCircle(450f, 350f, 300f, paint)
    }
}